package com.zqc.wms.exception;

import com.zqc.wms.entity.APIResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    public Object handleException(Exception ex) {
        String msg = ex.getMessage();
        log.error(msg, ex);
        return APIResponse.fail(msg);
    }
}
